<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <canvas id="canvas"></canvas>

    <script type="module">
      import { Color } from 'https://unpkg.com/three/build/three.module.js'
      const canvas = document.querySelector('#canvas')
      canvas.width = 200
      canvas.height = 200
      // 获取gl三维画笔
      const gl = canvas.getContext('webgl')
      // 生成Color对象
      const color = new Color('rgba(255,0,0,1)')
      !(function animate() {
        color.offsetHSL(0.005, 0, 0)
        const { r, g, b, a } = color
        gl.clearColor(r, g, b, a)
        gl.clear(gl.COLOR_BUFFER_BIT)
        requestAnimationFrame(animate)
      })()
    </script>
  </body>
</html>
